home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Languguage OS 2
/
Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO
/
language
/
embedded
/
simulato
/
v2_3_mc6.tz
/
v2_3_mc6
/
testfiles
/
cmpmtest.asm
< prev
next >
Wrap
Assembly Source File
|
1994-05-02
|
2KB
|
68 lines
org $1000
movea.l #str1,a0
jsr WriteString
movea.l #str1,a0
movea.l #str2,a1
loop cmpm.b (a0)+,(a1)+
bne broke
cmpi.b #$0,(a0)
beq done
jmp loop
broke movea.l #str2,a0
jsr WriteString
done movea.l #str3,a0
jsr WriteString
move #228,D7 ; end routine.
trap #14 ; ends prog.
;===========================================================================
; System routines begin here
;
;
OUTPUT equ 243
dc.w 0
;============================================================================
;
; WriteString - given the starting address of a string in A0, this routine
; will write the string to the screen. The string must be
; terminated by a null byte ($00).
; USAGE : JSR WriteString
; Given : 1. A0 = Address of first character in string
; 2. Last character in string is $00 or NULL
;
;
WriteString movem.l a0-a6/d0-d7,-(sp) ; save registers
move.l a0,a1 ; a0 is overwritten when OUTPUT is called
; so keep track of location within the
; string using a1
movea.l a0,a5
movea.l a0,a6
move #OUTPUT,d7
1$ adda.l #1,a6
move.b (a1)+,d0 ; get a byte
tst.b d0 ; check for null
beq 2$
bra 1$
2$ trap #14 ; print it
movem.l (sp)+,d7-d0/a6-a0 ; restore registers
rts
; DATA BEGINS HERE
str1 dc.b 'This is a message',13,10,0
str2 dc.b 'This didn''t work',13,10,0
str3 dc.b 'exiting',13,10,0
end